<?php

namespace Model;

use Nette;

class EventsModel extends BaseModel
{
	/**
	 * getAll
	 *
	 * @return array
	 */
	public function getAll()
	{
		$result = $this->db->select('e.*')
						   ->select("CONCAT_WS(' ', u.name, u.surname)")->as('nameUser')
						   ->select('p.name')->as('namePlace')
						   ->from('events')->as('e')
						   ->join('users')->as('u')->on('u.id = e.user')
						   ->join('places')->as('p')->on('p.id = e.place');

		return $result;
	}
}